﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AteneoLibriBusinessLogic.Entities;

namespace AteneoLibriBusinessLogic.TOA
{
    class UserAssembler
    {

        public static User Assembler(AteneoLibriEntityFramework.User item)
        {
            User u = new User();

            u.IdUser = item.IdUser;
            u.Name = item.Name;
            u.Surname = item.Surname;
            u.Email = item.Email;
            u.Username = item.Username;
            u.Password = item.Password;
            u.RecoveryCode = item.RecoveryCode;
            u.ZipCode = item.ZipCode;
            u.UniversityId = item.UniversityId;
            u.FacultyId = item.FacultyId;
            u.RegistrationData = item.RegistrationData;
            u.LastUpdate = item.LastUpdate;
            u.LastAccess = item.LastAccess;
            u.ThirdPartPrivacy = item.ThirdPartPrivacy;
            u.VerifyRegistration = item.VerifyRegistration;
            u.IsSuspended = item.IsSuspended;
            u.IPAddress = item.IPAddress;
            u.MarketingNewsletter = item.MarketingNewsletter;

            return u;
        }

        public static AteneoLibriEntityFramework.User DeAssembler(User item)
        {
            AteneoLibriEntityFramework.User u = new AteneoLibriEntityFramework.User();

            u.IdUser = item.IdUser;
            u.Name = item.Name;
            u.Surname = item.Surname;
            u.Email = item.Email;
            u.Username = item.Username;
            u.Password = item.Password;
            u.RecoveryCode = item.RecoveryCode;
            u.ZipCode = item.ZipCode;
            u.UniversityId = item.UniversityId;
            u.FacultyId = item.FacultyId;
            u.RegistrationData = item.RegistrationData;
            u.LastUpdate = item.LastUpdate;
            u.LastAccess = item.LastAccess;
            u.ThirdPartPrivacy = item.ThirdPartPrivacy;
            u.VerifyRegistration = item.VerifyRegistration;
            u.IsSuspended = item.IsSuspended;
            u.IPAddress = item.IPAddress;
            u.MarketingNewsletter = item.MarketingNewsletter;

            return u;
        }

        public static void WriteToEntity(AteneoLibriEntityFramework.User entity, User item)
        {
            entity.IdUser = item.IdUser;
            entity.Email = item.Email;
            entity.Username = item.Username;
            entity.Password = item.Password;
            entity.RecoveryCode = item.RecoveryCode;
            entity.ZipCode = item.ZipCode;
            entity.UniversityId = item.UniversityId;
            entity.FacultyId = item.FacultyId;
            entity.RegistrationData = item.RegistrationData;
            entity.LastUpdate = item.LastUpdate;
            entity.LastAccess = item.LastAccess;
            entity.PhoneNumber = item.PhoneNumber;
            entity.Name = item.Name;
            entity.Surname = item.Surname;
            entity.ThirdPartPrivacy = item.ThirdPartPrivacy;
            entity.VerifyRegistration = item.VerifyRegistration;
            entity.IsSuspended = item.IsSuspended;
            entity.IPAddress = item.IPAddress;
            entity.MarketingNewsletter = item.MarketingNewsletter;

        }

    }
}
